package leetcode.easy;

public class $28_strStr {
    public int strStr(String haystack, String needle) {
        if (needle == null || needle.equals(""))
            return 0;
        int left = 0;
        int right = needle.length();
        while (right <= haystack.length()) {
            String s = haystack.substring(left, right);
            if (s.equals(needle)) {
                return left;
            } else {
                left++;
                right++;
            }
        }
        return -1;
    }
}
